]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix dragging of App Well and Places icons
authorDan Winship <danw@gnome.org>
Wed, 24 Mar 2010 17:27:21 +0000 (13:27 -0400)
committerDan Winship <danw@gnome.org>
Wed, 24 Mar 2010 17:48:29 +0000 (13:48 -0400)
The hover rewrite added a freeze/thaw_notify to
st_clickable_leave_event() (to match the one already in
st_clickable_enter_event()), which broke code in two places that
assumed "pressed" would still be TRUE when "hover" changed to FALSE.
Fix that by exposing the "held" property as well.

js/ui/appDisplay.js
js/ui/placeDisplay.js
src/st/st-clickable.c

index a8f878efa913849cceb7a8d63f4fa04eab305a79..6b882320c6e33f27760656ed822bd2a1d28fc2f7 100644 (file)
@@ -451,7 +451,7 @@ AppWellIcon.prototype = {
     _onHoverChange: function(actor) {
         let hover = this.actor.hover;
         if (!hover) {
-            if (this.actor.pressed && this._dragStartX != null) {
+            if (this.actor.held && this._dragStartX != null) {
                 this.actor.fake_release();
                 this._draggable.startDrag(this._dragStartX, this._dragStartY,
                                           global.get_current_time());
index 99aecec487a0b7443c846f67e1dda55b3d4b4c0d..cd9167fee62589436cf1655520e47d037b42d9d2 100644 (file)
@@ -476,7 +476,7 @@ DashPlaceDisplayItem.prototype = {
     _onHoverChanged: function(button) {
         let hover = button.hover;
         if (!hover) {
-            if (button.pressed && this._dragStartX != null) {
+            if (button.held && this._dragStartX != null) {
                 button.fake_release();
                 this._draggable.startDrag(this._dragStartX, this._dragStartY,
                                           global.get_current_time());
index 2ff8758174bdfef86101953732582ea5326d02d0..79192cfc5cc224798383028b1bfba1cd8a223463 100644 (file)
@@ -32,7 +32,8 @@ enum {
   PROP_0,
 
   PROP_ACTIVE,
-  PROP_PRESSED,
+  PROP_HELD,
+  PROP_PRESSED
 };
 
 static guint st_clickable_signals [LAST_SIGNAL] = { 0 };
@@ -223,6 +224,9 @@ st_clickable_get_property (GObject         *object,
     case PROP_ACTIVE:
       g_value_set_boolean (value, self->priv->active);
       break;
+    case PROP_HELD:
+      g_value_set_boolean (value, self->priv->held);
+      break;
     case PROP_PRESSED:
       g_value_set_boolean (value, self->priv->pressed);
       break;
@@ -277,6 +281,20 @@ st_clickable_class_init (StClickableClass *klass)
                                                          FALSE,
                                                          G_PARAM_READWRITE));
 
+  /**
+   * StClickable:held
+   *
+   * This property tracks whether the button has the pointer grabbed,
+   * whether or not the pointer is currently hovering over the button.
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_HELD,
+                                   g_param_spec_boolean ("held",
+                                                         "Held state",
+                                                         "Whether the mouse button is currently pressed",
+                                                         FALSE,
+                                                         G_PARAM_READABLE));
+
   /**
    * StClickable:pressed
    *